﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商机信息管理系统</title>
    <!-- Tell the browser to be respodnsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!--bootstrap-->
    <link href="@Url.Scrpit("~/Scripts/vendor/bootstrap/css/bootstrap.min.css")" rel="stylesheet" />
    <!--awesome-->
    <link href="@Url.Scrpit("~/Scripts/vendor/adminlte/dist/css/font-awesome.min.css")" rel="stylesheet" />
    <!-- Ionicons -->
    <link href="@Url.Scrpit("~/Scripts/vendor/adminlte/dist/css/ionicons.min.css")" rel="stylesheet" />
    <!-- Theme style -->
    <link href="@Url.Scrpit("~/Scripts/vendor/adminlte/dist/css/AdminLTE.min.css")" rel="stylesheet" />
    <!-- iCheck -->
    <link href="@Url.Scrpit("~/Scripts/vendor/iCheck/square/blue.css")" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition login-page" style="height:80%">
    <div class="login-box">
        <div class="login-logo">
            <a href="#"><b>商机信息管理系统登录</b></a>
        </div>
        <!-- /.login-logo -->
        <div class="login-box-body">
            @*<p class="login-box-msg">Sign in to start your session</p>*@
            <form id="form" role="form">
                <div class="form-group has-feedback">
                    <input id="phoneNum" name="phoneNum" type="text" class="form-control" required placeholder="请输入手机号">
                    <span class="glyphicon glyphicon-user form-control-feedback"></span>
                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group has-feedback">
                    <input id="code" name="code" type="text" required autocomplete="off" class="form-control" placeholder="请输入验证码">
                    <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group has-feedback">
                    <button id="sendShortMsg" onclick="sendVerifyCode(0)" type="button" class="btn btn-primary btn-block btn-flat">发送短信</button>
                    <button id="sendVoice" onclick="sendVerifyCode(1)" type="button" class="btn btn-primary btn-block btn-flat">发送语音</button>
                </div>
                <div class="row">
                    <!-- /.col -->
                    <div class="col-xs-12">
                        <button type="submit" class="btn btn-primary btn-block btn-flat">登录</button>
                    </div>
                    <!-- /.col -->
                </div>
            </form>
            相关链接：<a href="http://gxsystem.act.cnool.net">施工管理平台</a>
        </div>
        <!-- /.login-box-body -->
    </div>
    <!-- /.login-box -->
    <!-- jQuery 2.2.3 -->
    <script src="@Url.Scrpit("~/Scripts/vendor/jQuery/jquery-2.2.3.min.js")"></script>

    <!--jQuery-cookie-->
    <script src="@Url.Scrpit("~/Scripts/vendor/jQuery-cookie/jquery.cookie.min.js")"></script>

    <!-- iCheck -->
    <script src="@Url.Scrpit("~/Scripts/vendor/iCheck/icheck.min.js")"></script>
    <!--bootstrap-->
    <script src="@Url.Scrpit("~/Scripts/vendor/bootstrap/js/bootstrap.min.js")"></script>
    <script src="@Url.Scrpit("~/Scripts/vendor/bootstrap/js/bootstrap-BtnBuilder.js")"></script>
    <script src="@Url.Scrpit("~/Scripts/vendor/bootstrap-validator/validator.min.js")"></script>
    <!--layer-->
    <script src="@Url.Scrpit("~/Scripts/vendor/layer/layer.js")"></script>
    <script src="@Url.Scrpit("~/Scripts/vendor/layer/layer-extends.js")"></script>
    <!--fx-->
    <script src="@Url.Scrpit("~/Scripts/util/util.js")"></script>

    <script>
        var rootUrl = '@Url.Content("~/")';
        var lastSendTime = null;
        $(function () {
            //表单校验
            $('#form').validator().on('submit', function (e) {
                //校验成功
                if (!e.isDefaultPrevented()) {
                    e.preventDefault();

                    var values = $('#form').getValues();
                    loading();
                    $.postJSON(rootUrl + 'Home/SubmitLogin_VerifyCode', values, function (resJson) {
                        loading(false);

                        if (resJson.Success) {
                            window.location.href = rootUrl;
                        }
                        else {
                            dialogError(resJson.Msg);
                        }
                    });
                }
            })
        });

        //发送验证码
        function sendVerifyCode(type) {
            if (lastSendTime) {
                var second = (new Date().getTime() - lastSendTime.getTime()) / 1000;
                second = 60 - parseInt(second);
                if (second > 0) {
                    dialogError('请{0}秒后再发送'.format(second));
                    return;
                }
            }

            var phoneNum = $('#phoneNum').val();
            if (phoneNum) {
                loading();
                $.postJSON(rootUrl + 'Home/SendVerifyCode', { phoneNum: phoneNum, type: type }, function (resJson) {
                    loading(false);

                    if (resJson.Success) {
                        lastSendTime = new Date();
                        dialogSuccess('发送成功');
                    }
                    else {
                        dialogError(resJson.Msg);
                    }
                });
            } else {
                dialogError('请输入手机号');
            }
        }
    </script>
</body>
</html>
